﻿

function Loadtagit() {

    //alert('Loadtagit')
    var list = [];
    $.ajax({
        type: "post",
        url: "EditProfile.aspx/LoadSkill",
        // data: "{ ProfessionalInfoID : '" + proID + "' }",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: true,
        success: function (data) {
            if (data.d.length > 0) {
                //alert('data.d.length ' + data.d.length)
                var items = [];
                for (var i = 0; i < data.d.length; i++) {
                    list.push(data.d[i])
                }
                for (var i = 0; i < list.length; i++) {
                    $('#allowSpacesTags').append('<li>' + list[i] + '</li>'); //Using Option 2
                }


                $("#allowSpacesTags").tagit({
                    availableTags: list,
                    allowSpaces: true,
                    caseSensitive: false,
                    removeConfirmation: true,
                    maxTags: 2,
                    sortable: true,
                    select: true,
                    placeholderText: "Add skills..."
                });
            }
        },
        error: function (xmlHttpRequest, textStatus, errorThrown) {
            $("#allowSpacesTags").tagit({
                availableTags: '',
                allowSpaces: true,
                caseSensitive: false,
                removeConfirmation: true,
                maxTags: 2,
                sortable: true,
                select: true,
                placeholderText: "Add more skills..."
            });

            //alert(xmlHttpRequest.statusText);
            //alert(xmlHttpRequest.responseText);
            //alert(textStatus);
            //alert(errorThrown);
        }
    });

}
